<!--
 * @Author: Meow
 * @Date: 2019-10-10 19:01:17
 * @LastEditors: Meow
 * @LastEditTime: 2019-10-13 22:19:48
 * @Description: 添加流程 和 添加流程节点
 -->
<template>
  <div id="ProcessManagement">
    <div class="detail">
      <div class="detail-top">
        <el-button @click="back">返回</el-button>
      </div>

      <!-- 弹出层 [添加]流程节点↓-->
      <el-dialog title="修改流程节点" :visible.sync="showDialog" width="70%">
        <el-tabs v-model="activeName" type="card">
          <el-tab-pane label="基本信息" name="first">
            <!-- tabs1:基本信息↓ -->
            <el-form :model="formData2.skyBusiProceNodes[0]" label-width="80px">
              <el-form-item label="节点名称">
                <el-input v-model="formData2.skyBusiProceNodes[0].nodeName"></el-input>
              </el-form-item>
              <el-form-item label="业务密级">
                <el-select v-model="formData2.skyBusiProceNodes[0].secretLevel" placeholder="请选择">
                  <el-option
                    v-for="item in Options1"
                    :key="item.name"
                    :label="item.name"
                    :value="item.name"
                  ></el-option>
                </el-select>
                <!-- <el-input v-model="formData2.skyBusiProceNodes[0].secretLevel"></el-input> -->
              </el-form-item>
              <el-form-item label="节点类型">
                <el-select v-model="formData2.skyBusiProceNodes[0].nodeType" placeholder="请选择">
                  <el-option
                    v-for="item in Options2"
                    :key="item.name"
                    :label="item.name"
                    :value="item.name"
                  ></el-option>
                </el-select>
                <!-- <el-input v-model="formData2.skyBusiProceNodes[0].nodeType"></el-input> -->
              </el-form-item>
              <el-form-item label="业务边界">
                <el-input v-model="formData2.skyBusiProceNodes[0].businessBoundary"></el-input>
              </el-form-item>
              <el-form-item label="标签">
                <el-input v-model="formData2.skyBusiProceNodes[0].label"></el-input>
              </el-form-item>
            </el-form>
            <!-- tabs1:基本信息↑ -->
          </el-tab-pane>
          <el-tab-pane label="执行单位" name="second">
            <!-- tabs2:执行单位 ↓-->
            <el-button type="primary" @click="add1">添加</el-button>
            <el-table
              :data="formData2.skyBusiExecDepartments"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              border
              style="width: 100%"
            >
              <el-table-column prop="unitName" label="单位名称" align="center"></el-table-column>
              <el-table-column prop="execOffice" label="执行处室" align="center"></el-table-column>
              <el-table-column label="操作" align="center" min-width="150">
                <el-button size="mini" type="primary" @click="del1">删除</el-button>
              </el-table-column>
            </el-table>
            <!-- tabs2:执行单位 ↑-->
          </el-tab-pane>
          <el-tab-pane label="信息化系统" name="third">
            <!-- tabs3:信息化系统 ↓-->
            <el-button type="primary" @click="add2">添加</el-button>
            <el-table
              :data="formData2.skyBusiInforSystems"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              border
              style="width: 100%"
            >
              <el-table-column prop="systemName" label="单位名称" align="center"></el-table-column>
              <el-table-column prop="execRole" label="执行处室" align="center"></el-table-column>
              <el-table-column label="操作" align="center" min-width="150">
                <el-button size="mini" type="primary" @click="del1">删除</el-button>
              </el-table-column>
            </el-table>
            <!-- tabs3:信息化系统 ↑-->
          </el-tab-pane>
          <el-tab-pane label="上游节点" name="fourth">
            <!-- tabs4:上游节点 ↓-->
            <el-button type="primary" @click="add3">添加</el-button>
            <el-table
              :data="formData2.skyBusiUpstreamNodes"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              border
              style="width: 100%"
            >
              <el-table-column prop="parentNode" label="上游节点所属流程" align="center"></el-table-column>
              <el-table-column prop="accessParam" label="上游节点" align="center"></el-table-column>
              <el-table-column prop="busiProceName" label="接入参数" align="center"></el-table-column>
              <el-table-column label="操作" align="center" min-width="150">
                <el-button size="mini" type="primary" @click="del1">删除</el-button>
              </el-table-column>
            </el-table>
            <!-- tabs4:上游节点 ↑-->
          </el-tab-pane>
          <el-tab-pane label="输出参数" name="fifth">
            <!-- tabs5:输出参数 ↓-->
            <el-button type="primary" @click="add4">添加</el-button>
            <el-table
              :data="formData2.skyBusiOutputParams"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              border
              style="width: 100%"
            >
              <el-table-column prop="paramType" label="参数类型" align="center"></el-table-column>
              <el-table-column prop="systemId" label="所属系统" align="center"></el-table-column>
              <el-table-column prop="paramName" label="参数名称" align="center"></el-table-column>
              <el-table-column label="操作" align="center" min-width="150">
                <el-button size="mini" type="primary" @click="del1">删除</el-button>
              </el-table-column>
            </el-table>
            <!-- tabs5:输出参数 ↑-->
          </el-tab-pane>
          <el-tab-pane label="业务规则" name="sixth">
            <!-- tabs6:业务规则 ↓-->
            <el-button type="primary" @click="add5">添加</el-button>
            <el-table
              :data="formData2.skyBusiRules"
              :header-cell-style="{background:'#eef1f6',color:'#606266'}"
              border
              style="width: 100%"
            >
              <el-table-column prop="ruleType" label="规则类型" align="center"></el-table-column>
              <el-table-column prop="ruleSummary" label="规则概述" align="center"></el-table-column>
              <el-table-column prop="manageRule" label="治理规则" align="center"></el-table-column>
              <el-table-column label="操作" align="center" min-width="150">
                <el-button size="mini" type="primary" @click="del1">删除</el-button>
              </el-table-column>
            </el-table>
            <!-- tabs6:业务规则 ↑-->
          </el-tab-pane>
        </el-tabs>
        <span slot="footer" class="dialog-footer">
          <el-button @click="showDialog = false">取 消</el-button>
          <el-button type="primary" @click="submitNode">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 弹出层 [添加]流程节点↑ -->

      <!-- 弹出层 [执行单位的添加]↓-->
      <el-dialog title="添加执行单位" :visible.sync="showDialog1" width="30%" :before-close="handleClose">
        <el-form label-width="80px">
          <el-form-item label="执行单位:">
            <el-select v-model="templateJson1.unitName" placeholder="请选择">
              <!-- 执行单位下拉框 -->
              <el-option
                v-for="item in Aoptions1"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <!-- 执行处室下拉框 ※暂用input -->
          <!-- <el-select v-model="templateJson1.execOffice" placeholder="请选择">
          <el-option
            v-for="item in Aoptions2"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          ></el-option>
          </el-select>-->
          <el-form-item label="执行处室:">
            <el-input v-model="templateJson1.execOffice"></el-input>
          </el-form-item>
        </el-form>

        <span slot="footer" class="dialog-footer">
          <el-button @click="showDialog1 = false">取 消</el-button>
          <el-button type="primary" @click="sure1">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 弹出层 [执行单位的添加]↑ -->

      <!-- 弹出层 [信息化系统的添加]↓-->
      <el-dialog
        title="添加信息化系统"
        :visible.sync="showDialog2"
        width="30%"
        :before-close="handleClose"
      >
        <el-form label-width="80px">
          <el-form-item label="系统名称:">
            <el-select v-model="templateJson2.systemName" placeholder="请选择">
              <!-- 执行单位下拉框 -->
              <el-option
                v-for="item in Boptions1"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="执行处室:">
            <el-input v-model="templateJson2.execRole"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="showDialog2 = false">取 消</el-button>
          <el-button type="primary" @click="sure2">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 弹出层 [信息化系统的添加]↑ -->

      <!-- 弹出层 [上游节点的添加]↓-->
      <el-dialog title="添加上游节点" :visible.sync="showDialog3" width="30%" :before-close="handleClose">
        <el-form ref="form" :model="templateJson3" label-width="80px">
          <el-form-item label="所属流程:">
            <!-- <el-select
              v-model="templateJson3.parentNode"
              @change="ChangeGetCoptions"
              placeholder="请选择"
            >
              <el-option
                v-for="item in Coptions1"
                :key="item.busiProceName"
                :label="item.busiProceName"
                :value="item.busiProceId"
              ></el-option>
            </el-select>-->
            <!-- <el-input v-model="templateJson3.busiProceName" :disabled="true"></el-input> -->
            <el-input v-model="baseInfoData.busiProceName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="上游节点:">
            <el-select v-model="templateJson3.parentNode" placeholder="请选择">
              <el-option
                v-for="item in Coptions2"
                :key="item.nodeName"
                :label="item.nodeName"
                :value="item.nodeName"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="接入参数:">
            <el-input v-model="templateJson3.accessParam"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="showDialog3 = false">取 消</el-button>
          <el-button type="primary" @click="sure3">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 弹出层 [上游节点的添加]↑ -->

      <!-- 弹出层 [输出参数的添加]↓-->
      <el-dialog title="添加输出参数" :visible.sync="showDialog4" width="30%" :before-close="handleClose">
        <el-form ref="form" :model="templateJson3" label-width="80px">
          <el-form-item label="参数类型:">
            <el-select v-model="templateJson4.paramType" placeholder="请选择">
              <el-option
                v-for="item in Doptions1"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="所属系统:">
            <el-select v-model="templateJson4.systemId" placeholder="请选择">
              <el-option
                v-for="item in Doptions2"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="参数名称:">
            <el-input v-model="templateJson4.paramName"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="showDialog4 = false">取 消</el-button>
          <el-button type="primary" @click="sure4">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 弹出层 [输出参数的添加]↑ -->
      <!-- 弹出层 [业务规则的添加]↓-->
      <el-dialog title="添加业务规则" :visible.sync="showDialog5" width="30%" :before-close="handleClose">
        <el-form ref="form" :model="templateJson3" label-width="80px">
          <el-form-item label="规则类型:">
            <el-select v-model="templateJson5.ruleType" placeholder="请选择">
              <el-option
                v-for="item in Eoptions1"
                :key="item.name"
                :label="item.name"
                :value="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="规则概述:">
            <el-input v-model="templateJson5.ruleSummary"></el-input>
          </el-form-item>
          <el-form-item label="治理规则:">
            <el-input v-model="templateJson5.manageRule"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="showDialog5 = false">取 消</el-button>
          <el-button type="primary" @click="sure5">确 定</el-button>
        </span>
      </el-dialog>
      <!-- 弹出层 [业务规则的添加]↑ -->
      <!-- ---------------------------------------------------------------------------------------------------------------- -->
      <!-- 基本信息 -->
      <div class="baseInfo" v-if="isStep1">
        <h1>基本信息</h1>
        <ul>
          <li>
            <label>业务流程名称：</label>
            <el-input type="text" v-model="baseInfoData.busiProceName" />
            <!-- <span>*</span> -->
          </li>
          <li @click="GetOptions" class="HalfWidth">
            <label>父流程：</label>
            <el-select
              v-model="baseInfoData.parentId"
              placeholder="请选择"
              @change="ChangeBusiProceId"
            >
              <el-option
                v-for="v in fatherFlowOptions"
                :key="v.busiProceId"
                :label="v.busiProceName"
                :value="v.busiProceId"
              ></el-option>
            </el-select>
          </li>
          <li @click="GetOptions" class="HalfWidth" v-if="baseInfoData.parentId">
            <label>父节点：</label>
            <el-select v-model="baseInfoData.parentNode" placeholder="请选择">
              <el-option
                v-for="v in fatherNodeOptions"
                :key="v.nodeId"
                :label="v.businessBoundary"
                :value="v.nodeId"
              ></el-option>
            </el-select>
          </li>
          <li>
            <label for>概述：</label>
            <el-input type="text" v-model="baseInfoData.summary" />
          </li>
          <li>
            <label for>标签：</label>
            <el-input type="text" v-model="baseInfoData.label" />
          </li>
        </ul>
        <div class="nextButton">
          <el-button @click="SaveFlow" type="primary">下一步</el-button>
        </div>
      </div>
      <!-- 流程节点 -->
      <div class="processNode" v-else>
        <!-- <div class="processNode"> -->
        <div class="processNode-top">
          <h1>流程节点</h1>
          <el-button @click="ClickAddNode" type="primary">添加</el-button>
        </div>
        <div class="processNode-table">
          <!-- <Table :tableData="tableData" /> -->
          <el-table
            :data="NodeForm"
            border
            style="width: 100%"
            :header-cell-style="{background:'#eef1f6',color:'#606266'}"
          >
            <el-table-column prop="nodeName" label="业务名称" align="center"></el-table-column>
            <el-table-column prop="nodeType" label="节点类型" align="center"></el-table-column>
            <el-table-column prop="secretLevel" label="业务密级" align="center"></el-table-column>
            <el-table-column prop="businessBoundary" label="业务边界" align="center"></el-table-column>
            <el-table-column prop="label" label="标签" align="center"></el-table-column>
            <el-table-column label="操作" align="center">
              <el-button size="mini" type="primary">删除</el-button>
            </el-table-column>
          </el-table>
        </div>
        <!-- <el-button @click="submit">提交</el-button> -->
      </div>
    </div>
  </div>
</template>
<script>
import Table from "./Table";
import Form from "./Form";
import processManagementApi from "@/httpUtils/ExternalManagement/processManagement";
export default {
  name: "ProcessManagementView",
  components: {
    Table,
    Form
  },
  data() {
    return {
      busiProceId: "", //流程ID
      isStep1: true, // 是否是步骤1 ※步骤1:添加业务流程 步骤2:对该流程添加流程节点
      // 步骤1: 添加业务流程时所需的基本信息数据参数
      baseInfoData: {
        busiProceName: "", // 业务流程名
        parentId: "", // 父流程id 下拉列表的ID
        summary: "", // 概述
        label: "", // 标签
        parentNode: "" // 父节点
      },
      // 对刚添加业务流程添加流程节点时所需的参数表单
      formData2: {
        // 基本信息
        skyBusiProceNodes: [
          {
            nodeName: "", // 节点名称
            nodeType: "", //  节点类型
            businessBoundary: "", // 业务边界
            label: "", // 标签
            secretLevel: "", // 业务密级
            busiProceId: "" // 流程ID
          }
        ],
        // 执行单位
        skyBusiExecDepartments: [
          // {
          //   unitName: "自然资源局12",
          //   execOffice: "办公室12"
          // },
          // {
          //   unitName: "自然资源局22",
          //   execOffice: "办公室22"
          // }
        ],
        // 信息化系统
        skyBusiInforSystems: [
          // {
          //   systemName: "系统A12",
          //   execRole: "超级管理12员"
          // },
          // {
          //   systemName: "系统A22",
          //   execRole: "超级管理员22"
          // }
        ],
        // 上游节点
        skyBusiUpstreamNodes: [
          // {
          //   parentNode: "设计初设12",
          //   accessParam: "初设专题图层21",
          //   busiProceName: "当前业务流程名"
          // },
          // {
          //   parentNode: "设计初设22",
          //   accessParam: "初设专题图层22",
          //   busiProceName: "当前业务流程22"
          // }
        ],
        // 输出参数
        skyBusiOutputParams: [
          // {
          //   paramType: "接口21", // 参数类型
          //   systemId: "系统A21", // 所属系统
          //   paramName: "地名21" // 参数名称
          // },
          // {
          //   paramType: "接口22",
          //   systemId: "系统A22",
          //   paramName: "地名22"
          // }
        ],
        // 业务规则
        skyBusiRules: [
          // {
          //   ruleType: "参数接入规则21", // 规则类型
          //   ruleSummary: "测试21", // 规则概述
          //   manageRule: "测试21" // 治理规则
          // },
          // {
          //   ruleType: "参数接入规则22",
          //   ruleSummary: "测试22",
          //   manageRule: "测试22"
          // }
        ]
      },
      // 执行单位模版
      templateJson1: {
        unitName: "", // 单位名称
        execOffice: "" // 执行处室
      },
      // 信息化系统模版
      templateJson2: {
        systemName: "系统名称", // 系统名称
        execRole: "" // 执行角色
      },
      // 上游节点模版
      templateJson3: {
        parentNode: "无", // 上游节点
        accessParam: "", // 接入参数
        busiProceName: "" // 上游节点所属流程ID
      },
      // 输出参数模版
      templateJson4: {
        paramType: "", // 参数类型
        systemId: "", // 所属系统
        paramName: "" // 参数名称
      },
      // 业务规则模版
      templateJson5: {
        ruleType: "", // 规则类型
        ruleSummary: "", // 规则概述
        manageRule: "" // 治理规则
      },
      // 业务密级下拉列表
      Options1: [
        { name: "机密" },
        { name: "绝密" },
        { name: "秘密" },
        { name: "敏感" }
      ],
      // 节点类型
      Options2: [
        { name: "实体节点" },
        { name: "判断节点" },
        { name: "线下节点" }
      ],
      // 弹出层下拉列表数据------------
      Aoptions1: [], // 单位名称下拉列表
      Aoptions2: [], // 执行处室下拉列表
      Boptions1: [], // 系统名称下拉列表
      Coptions1: [], // 上游节点所属流程下拉列表
      Coptions2: [], // 上游节点下拉列表
      Doptions1: [{ name: "文件" }, { name: "接口" }], // 输出参数-参数类型下拉列表
      Doptions2: [], // 输出参数-所属系统下拉列表
      Eoptions1: [{ name: "参数接入规则" }, { name: "异常处理规则" }], // 输出参数-所属系统下拉列表

      fatherFlowOptions: [], // 父流程下拉列表数据
      fatherNodeOptions: [], // 父节点下拉列表数据

      activeName: "first", // 当前弹出层
      showDialog: false, // 是否显示总弹出层
      showDialog1: false, // [执行单位]添加弹出层
      showDialog2: false, // [信息化系统]添加是否显示总弹出层
      showDialog3: false, // [上游节点]添加是否显示总弹出层
      showDialog4: false, // [输出参数]添加是否显示总弹出层
      showDialog5: false, // [业务规则]添加是否显示总弹出层
      NodeForm: []
    };
  },
  mounted() {
    this.GetOptions(); // 获取父流程下拉列表
  },
  methods: {
    // Step1: 流程基本信息相关功能--------------------------------- ---------------
    // --获取父流程下拉列表数据
    GetOptions() {
      // 参数用于查询
      let params = {
        busiProceName: "" // 关键词搜索
      };
      processManagementApi.tableData(params).then(res => {
        console.log(" 获取父流程下拉列表数据--------------", res.data.data);
        this.fatherFlowOptions = res.data.data;
      });
    },
    // --父流程下拉列表选中的值发生变化的时候请求接口获取父节点下拉列表数据,并清除已选的父节点值
    ChangeBusiProceId(data) {
      console.log(data);
      this.baseInfoData.parentNode = "";
      this.GetOptions2(data); // data:busiProceId
    },
    // --获取父节点下拉列表数据
    GetOptions2(data) {
      console.log("获取父节点下拉列表", data);
      let params = {
        busiProceId: data
      };
      processManagementApi.findCata(params).then(res => {
        console.log(" 获取父节点下拉列表数据--------------", res.data.data);
        this.fatherNodeOptions = res.data.data;
      });
    },
    // 点击保存流程，下一步进行节点添加操作
    SaveFlow() {
      console.log(this.baseInfoData);
      if (this.baseInfoData.busiProceName) {
        processManagementApi.createCata(this.baseInfoData).then(res => {
          console.log("保存流程数据", res.data);
          if (res.data.code == 200) {
            this.formData2.skyBusiProceNodes[0].busiProceId = res.data.data; // 将流程ID保存至步骤二添加流程节点的表单中
            this.isStep1 = false; // 进入步骤2
            this.$message({
              message: "添加流程成功",
              type: "success"
            });
            this.busiProceId = res.data.data;
          } else {
            this.$message({
              message: "添加流程失败",
              type: "warning"
            });
          }
        });
      } else {
        this.$message({
          message: "请输入流程名称",
          type: "warning"
        });
      }
    },
    // ---------------------------------------------------------------------------
    // Step2: 流程节点相关功能-----------------------------------------------------
    // --点击流程节点[添加]按钮 显示弹出层
    ClickAddNode() {
      this.showDialog = true;
    },
    // -- 执行单位添加
    add1() {
      this.showDialog1 = true;
      this.GetAoptions();
    },
    // -- 信息化系统添加
    add2() {
      this.showDialog2 = true;
      this.GetBoptions();
    },
    // -- 上游节点添加
    add3() {
      this.showDialog3 = true;
      console.log(this.formData2.skyBusiProceNodes[0].busiProceId);
      this.templateJson3.busiProceName = this.formData2.skyBusiProceNodes[0].busiProceId; // 所属流程的ID

      // this.GetCoptions(); // 获取上游节点所属流程下拉列表
      this.GetCoptions2(); // 获取上游节点下拉列表
    },
    // -上游节点所属流程联动上游节点联动
    ChangeGetCoptions(data) {
      // console.log(data, "!!@#!@#!@");
      // this.GetCoptions2(data.busiProceId);
    },
    // -- 输出参数添加
    add4() {
      this.showDialog4 = true;
      this.GetBoptions();
    },
    // -- 业务规则添加
    add5() {
      this.showDialog5 = true;
    },
    // 添加执行单位 确定按钮
    sure1() {
      alert("执行单位添加成功");

      console.log("!!!!!!!!", this.templateJson1);
      this.formData2.skyBusiExecDepartments.push(this.templateJson1);
      console.log("!!!!!!!!", this.formData2);
      // 清空执行单位模版数据
      this.templateJson1 = {
        unitName: "", // 单位名称
        execOffice: "" // 执行处室
      };
      this.showDialog1 = false; // 关闭添加执行单位弹出层
    },
    // 添加信息化 确定按钮
    sure2() {
      alert("信息化系统添加成功");

      this.formData2.skyBusiInforSystems.push(this.templateJson2);
      console.log(this.formData2);
      // 清空执行单位模版数据

      this.templateJson2 = {
        systemName: "", // 系统名称
        execRole: "" // 执行角色
      };

      this.showDialog2 = false; // 关闭添加执行单位弹出层
    },
    // 上游节点 确定按钮
    sure3() {
      alert("上游节点添加成功");
      this.formData2.skyBusiUpstreamNodes.push(this.templateJson3);
      console.log(this.formData2);
      // 清空执行单位模版数据
      this.templateJson3 = {
        parentNode: "", // 上游节点
        accessParam: "", // 接入参数
        busiProceName: "" // 上游节点所属流程ID
      };
      this.showDialog3 = false; // 关闭添加执行单位弹出层
    },
    // 输出参数 确定按钮
    sure4() {
      alert("输出参数添加成功");
      this.formData2.skyBusiOutputParams.push(this.templateJson4);
      console.log(this.formData2);
      // 清空执行单位模版数据
      this.templateJson4 = {
        paramType: "", // 参数类型
        systemId: "", // 所属系统
        paramName: "" // 参数名称
      };
      this.showDialog4 = false; // 关闭添加执行单位弹出层
    },
    // 业务规则确定按钮
    sure5() {
      alert("业务规则添加成功");
      this.formData2.skyBusiRules.push(this.templateJson5);
      console.log(this.formData2);
      // 清空执行单位模版数据
      this.templateJson5 = {
        ruleType: "", // 规则类型
        ruleSummary: "", // 规则概述
        manageRule: "" // 治理规则
      };
      this.showDialog5 = false; // 关闭添加执行单位弹出层
    },

    // -- 执行单位删除
    del1() {},
    // 点击弹出层[确定],提交节点
    submitNode() {
      console.log(this.formData2.skyBusiProceNodes[0].nodeName);
      if (this.formData2.skyBusiProceNodes[0].nodeName) {
        processManagementApi.createCataInsert(this.formData2).then(res => {
          console.log("添加流程节点", res.data);
          if (res.data.code == 200) {
            // this.formData2.skyBusiProceNodes[0].busiProceId = res.data.data; // 将流程ID保存至步骤二添加流程节点的表单中
            this.isStep1 = false; // 进入步骤2
            this.$message({
              message: "添加流程节点成功",
              type: "success"
            });
            this.GetNode();
          } else {
            this.$message({
              message: "添加流程节点失败",
              type: "warning"
            });
          }
          this.showDialog = false; // 关闭流程节点弹出层
        });
        let busiProceId = this.busiProceId;
        // 重置模板数据
        this.formData2 = {
          // 基本信息
          skyBusiProceNodes: [
            {
              nodeName: "", // 节点名称
              nodeType: "", //  节点类型
              businessBoundary: "", // 业务边界
              label: "", // 标签
              secretLevel: "", // 业务密级
              busiProceId: busiProceId // 流程ID
            }
          ],
          skyBusiExecDepartments: [], // 执行单位
          skyBusiInforSystems: [], // 信息化系统
          skyBusiUpstreamNodes: [], // 上游节点
          skyBusiOutputParams: [], // 输出参数
          skyBusiRules: [] // 业务规则
        };
      } else {
        this.$message({
          message: "请输入节点名称",
          type: "warning"
        });
      }
    },
    // 添加信息化系统时:获取系统名称下拉列表
    GetAoptions() {
      // 获取单位名称下拉列表
      processManagementApi.findOrgCatalogTree().then(res => {
        console.log(" 获取单位名称下拉列表----", res.data.data);
        this.Aoptions1 = res.data.data;
      });
    },
    // --获取系统名称下拉列表数据
    GetBoptions() {
      processManagementApi.findAllSys().then(res => {
        console.log(" 获取系统名称下拉列表数据----", res.data.data);
        this.Boptions1 = res.data.data;
        this.Doptions2 = res.data.data;
      });
    },
    // 获取上游节点所属流程列表
    GetCoptions() {
      // processManagementApi.tableData().then(res => {
      //   console.log(" 获取上游节点所属流程!列表数据----", res.data.data);
      // this.Coptions1 = res.data.data;
      // });
      // this.Coptions1.push (this.baseInfoData.busiProceName);
    },
    // 获取上游节点列表
    GetCoptions2() {
      // let busiProceID = this.formData2.skyBusiProceNodes[0].busiProceId;
      let busiProceId = this.busiProceId;

      // processManagementApi
      //   .findCataDetail({ busiNodeId: busiProceID })
      //   .then(res => {
      //     console.log(" 获取上游节点!列表数据----", res.data.data);
      //     this.Coptions2 = res.data.data;
      //   });

      processManagementApi.findCata({ busiProceId: busiProceId }).then(res => {
        console.log(" 获取该流程所有节点列表", res.data.data);
        this.Coptions2 = res.data.data;
      });
    },
    // 获取该流程所有节点列表
    GetNode() {
      let busiProceId = this.busiProceId;
      processManagementApi.findCata({ busiProceId: busiProceId }).then(res => {
        console.log(" 获取该流程所有节点列表", res.data.data);
        this.NodeForm = res.data.data;
      });
    },
    // --------------------------------------
    // // 点击tabs
    // handleClick(tab, event) {
    //   console.log(tab, event);
    //   // 请求接口 => 得到表数据
    // },
    // 获取流程
    // 点击[返回]
    back() {
      this.$router.push({
        path: "/frame/ProcessManagementHost/ProcessManagementLogic"
      });
    },
    // 提交 --TODO去除
    submit() {
      console.log(this.formData2);
    },
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then(_ => {
          done();
        })
        .catch(_ => {});
    }
  }
};
</script>
<style lang="less" scoped>
.nextButton {
  .fdrr();
  .bb();
  padding: 0 20px;
}
// .HalfWidth{
//   width: 50%!important;
// }
@import url("../ProcessManagement.less");
</style>